import request from '@/util/request'
import { dealOpts, CRM } from './../api_type'

// 业务 -- 客户
const crmCreate = (params, opts) => {
  return request.post(dealOpts(CRM + '/createIntent', opts), params)
}

const crmUpdate = (params, opts) => {
  return request.post(dealOpts(CRM + '/modifyIntent', opts), params)
}

const crmDelete = (params, opts) => {
  return request.get(dealOpts(CRM + '/deleteIntent', opts), params)
}

const crmGetDues = (params, opts) => {
  return request.get(dealOpts(CRM + '/getDues', opts), params)
}

const crmGetIntents = (params, opts) => {
  return request.post(dealOpts(CRM + '/getIntents', opts), params)
}

const crmCheckIntents = (params, opts) => {
  return request.get(dealOpts(CRM + '/checkIntent', opts), params)
}

const crmGetIntentInfo = (params, opts) => {
  return request.get(dealOpts(CRM + '/getIntentInfo', opts), params)
}

// 变更业务员
const crmUpdateIntents = (params, opts) => {
  return request.get(dealOpts(CRM + '/changeSales', opts), params)
}

// 客户跟进
const crmGetSaleRecords = (params, opts) => {
  return request.get(dealOpts(CRM + '/getSaleRecords', opts), params)
}

const crmCreateSaleRecord = (params, opts) => {
  return request.get(dealOpts(CRM + '/createSaleRecord', opts), params)
}

export default {
  crmCreate,
  crmUpdate,
  crmGetDues,
  crmDelete,
  crmGetIntents,
  crmGetIntentInfo,
  crmGetSaleRecords,
  crmCreateSaleRecord,
  crmCheckIntents,
  crmUpdateIntents
}
